package day4.zy7;

import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String quit = "quit";
        FileWriter fw = null;
        try {
            while (true) {
                System.out.println("请输入");
                String str = sc.next();
                if (str.equals(quit)) {
                    return;
                } else {
                    SimpleDateFormat sj = new SimpleDateFormat("hh:mm:ss");
                    Date date = new Date();

                    fw = new FileWriter("C:\\Users\\admin\\Desktop\\新建文件夹\\新建文本文档.txt");

                    fw.write(sj.format(date));
                    fw.write("\t");
                    fw.write(str);
                    fw.write("\n");

                    fw.close();
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
